
// selecting only papers that meet the criteria: "we use Abeler et al.'s (2019) dataset, but keep only data that uses a six-sided die, in person,non-observed, non-repeated and with less than 10 control rolls."
use "data/truth_telling_meta_study_merged_data.dta", clear

keep if  method_of_ra== "die roll" // i.e. only dice
keep if true_distribution == "1D6"
drop if remote==1
drop if internal==1
drop if repeated==1
drop if number_of_control_rolls>10
bysort treatment: egen temp = mean(round)
drop if temp>1

* set scheme
set scheme plottig	

// transforming data to fit the 0-5 range
gen roll1=round(2.5+(standardized_report_per_round)*2.5,1)

bysort authors control_rolls: egen average_by_authors=mean(payoff_per_round)
sort control_rolls average_by_authors
tab control_rolls, su(roll1)
mean roll1, over(control_rolls)

* the text refernces this regression "p=0.182"
reg roll1  i.control_rolls , vce(cluster treatment)
 
* the text converts to SDs:
 di  .1443766/1.5745642 
 
* transforming data so one observation per paper 
collapse (mean) roll1  control_rolls  (sem) semq1 = roll1 , by(treatment)
* adding 95% confidence intervals
gen hiy=roll1+semq1
gen lowy=roll1-semq1

sort control_rolls roll1
gen temp1=_n
graph twoway (bar roll1  temp1 if control_rolls==0, col(gs9) barw(.6)) ///
(bar roll1  temp1 if control_rolls==1 ,  col( gs4) barw(.6) ///
ylabel(0(1)5) xlabel(none) xtitle("") legend( order(1 "Single Roll, Mean=3.251" 2 "Control Rolls, Mean=3.395" ) row(1) ring(0) position(6)) )   ///
(rcap hiy lowy temp1 ,lc(black) ) 	, scale(1.3) 

graph export "output/appendixfigure1.pdf", as(pdf) name("Graph") replace

